import { connect } from "react-redux";
import { submit, login } from "@store/login/actions";
import LoginFormSet from "@components/molecules/LoginFormSet";
import { withRouter } from "react-router-dom";

const mapStateToProps = state => {
  return {
    ...state.login
  };
};

const mapDispatchToProps = dispatch => {
  return {
    onSubmit: (data, history) => {
      dispatch(submit(data));
      console.log(data);
      dispatch(
        login({
          data,
          history
        })
      );
    }
  };
};

const HignLoginFormSet = withRouter(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(LoginFormSet)
);

export default HignLoginFormSet;
